import Vue from "vue";
import VueRouter from "vue-router";
import main from "../views/index.vue";
import home from "../views/home/index";
import login from "../views/login/index";
Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    name: "main",
    component: login,
    meta: {
      name: "登录",
    },
  },
  {
    path: "/",
    name: "main",
    redirect: "/main/home",
    component: main,
    children: [
      {
        path: "/main/home",
        name: "main.home",
        component: home,
        meta: {
          name: "home",
        },
      },
      {
        path: "/main/card",
        name: "main.card",
        component: () => import("../views/card/card.vue"),
        meta: {
          name: "card",
        },
      },
      {
        path: "/main/form",
        name: "main.form",
        component: () => import("../views/form/base.vue"),
        meta: {
          name: "form",
        },
      },
      {
        path: "/main/step",
        name: "main.step",
        component: () => import("../views/formStep/index.vue"),
        meta: {
          name: "step",
        },
      },
      {
        path: "/main/user",
        name: "main.user",
        component: () => import("../views/user/index.vue"),
        meta: {
          name: "user",
        },
      },
      {
        path: "/main/detilinfo",
        name: "main.detilinfo",
        component: () => import("../views/dashboard/index.vue"),
        meta: {
          name: "detilinfo",
        },
      },
    ],
  },
];

const router = new VueRouter({
  mode: "hash",
  routes,
});

export default router;
